package com.dc.entity.special;

import com.dc.entity.ShipRepairEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

/**
 *  4 拖船油耗 亚善-康帝
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "t_workflow_special_1_towship_oil")
public class WorkflowSpecial1TowShipOilEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "ship_repair_id", columnDefinition = "bigint unsigned NOT NULL", insertable = false, updatable = false)
    private Long shipRepairId;      // 维修记录 外键id

    @Column(name = "submit_time")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date submitTime;        // 填写日期

    @Column(name = "ship_name", length = 50)
    private String shipName;        // 船体名称

    @Column(name = "reporter", length = 20)
    private String reporter;        // 填报人

    ///////////////////////////////////////////////////////////////////////////
    @Column(name = "type", length = 10)
    private String type;            // 作业种类

    @Column(name = "tug", length = 20)
    private String tug;             // 协助拖轮船号

    @Column(name = "tug_power")
    private Double tugPower;        // 协助拖轮功率(HP)

    @Column(name = "oil")
    private Double oil;             // 作业消耗油量(L)

    @Column(name = "start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startTime;         // 开始时间

    @Column(name = "end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endTime;           // 结束时间

    @Column(name = "start_place", length = 50)
    private String startPlace;      // 开始地点

    @Column(name = "end_place", length = 50)
    private String endPlace;        // 结束地点

    @Column(name = "remark", length = 100)
    private String remark;          // 备注

    ////////////////////////////////////////////

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ship_repair_id")
    private ShipRepairEntity shipRepairEntity;

}
